import {defineStore} from "pinia";
import {computed, ref} from "vue";
export const useTokenStore = defineStore( "token",() =>{
   //定义state-需要分享的数据
    const token = ref(null);
    //定义getter-用来获取state经过转换之后的值
    const tokenStr = computed(() => {
        return token.value;
    });
    //定义action
    function update(tk){
        token.value = tk;
    }
    //重置state
    function $reset(){
        token.value = null;
    }
    return {token, tokenStr, update, $reset};

});